package com.liuzihao.Controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Author: Liuzihao
 * @Description:
 * @Date Created in 2021-10-21 21:15
 * @Modified By:
 */
@RestController
@Slf4j
public class PaymentController {

    private static final String PAYMENT_URL = "http://CloudPaymentConsul/";//微服务调用
    @Resource
    RestTemplate restTemplate;

    @GetMapping("/consumer/payment/getPaymentById/{id}")
    String getPaymentById(@PathVariable("id") Long id){
        return restTemplate.getForObject(PAYMENT_URL+"/payment/getPaymentById/"+id, String.class);
    }
}
